class_name InfoDialog
extends Control

@onready var label: RichTextLabel = $MarginContainer/NinePatchRect/MarginContainer/RichTextLabel
@export var word_speed: float = 3.0
var word_progress: float = 0
var text: String = ""


func diaplay_text(t):
	text = t
	word_progress = 0
	

func _physics_process(delta: float) -> void:
	if word_progress > text.length(): return
	
	word_progress += word_speed * delta
	var word_num_2_display = int(word_progress)
	label.text = text.substr(0, word_num_2_display)
	

func is_finish():
	return word_progress >= text.length()
	

func show_complete_text():
	word_progress = text.length()
